package logic

import (
	"context"
	"manager/model/mysql"

	"manager/merchantmanager/internal/svc"
	"manager/merchantmanager/merchantmanager"

	"github.com/zeromicro/go-zero/core/logx"
)

type DelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelLogic {
	return &DelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *DelLogic) Del(in *merchantmanager.RequestDel) (*merchantmanager.ResponseDel, error) {
	// todo: add your logic here and delete this line
	var data mysql.Merchant
	mysql.DB.Where("id=?", in.MerchantID).Delete(&data).First(&data)
	return &merchantmanager.ResponseDel{
		MerchantID: in.MerchantID,
	}, nil
}
